package com.woniu.cq.medical.service.impl;

import com.woniu.cq.medical.common.PageResult;
import com.woniu.cq.medical.controller.form.AttendanceRecordForm;
import com.woniu.cq.medical.entity.AdministrativeWorkloadAccount;
import com.woniu.cq.medical.entity.AttendanceRecord;
import com.woniu.cq.medical.dao.AttendanceRecordMapper;
import com.woniu.cq.medical.service.AttendanceRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2020-09-07
 */
@Service
public class AttendanceRecordServiceImpl extends ServiceImpl<AttendanceRecordMapper, AttendanceRecord> implements AttendanceRecordService {
    @Autowired
    private AttendanceRecordMapper attendanceRecordMapper;
    @Override
    public PageResult pageQuery(int pageIndex, int pageSize, String administrativeName, String doctorName,String doctorDuty,Date attendanceDateBefore, Date attendanceDateAfter) {
        long totalCount=attendanceRecordMapper.totalCount(administrativeName,doctorName,doctorDuty,attendanceDateBefore, attendanceDateAfter);
        int pageStart=(pageIndex-1)*pageSize;
        List<AttendanceRecordForm> list=attendanceRecordMapper.pageQuery(pageStart,pageSize,administrativeName,doctorName,doctorDuty,attendanceDateBefore, attendanceDateAfter);
        return PageResult.success(totalCount,pageIndex,pageSize,list);
    }
}
